using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CmdLine;

namespace NUMP4CS
{
    public class MainProgram
    {
        static void Main(string[] args)
        {

            try
            {
                var arguments = CommandLine.Parse<ProgramArgumentContainer>();
                var extractor = new ExtractAttributesDeclaration();
                extractor.Extract(arguments.Source, arguments.Destination);
            }
            catch (CommandLineException exception)
            {
                Console.WriteLine(exception.ArgumentHelp.Message);
                Console.WriteLine(exception.ArgumentHelp.GetHelpText(Console.BufferWidth));
            }
            Console.Read();
        }
    }

    [CommandLineArguments(Program = "NUMP2CS", Title = "NUMP2CS", Description = "extract attribute-definitions and serialization as NUM2CS XMI-Model")]
    public class ProgramArgumentContainer
    {
        [CommandLineParameter(Command = "?", Default = false, Description = "Show Help", Name = "Help", IsHelp = true)]
        public bool Help { get; set; }

        [CommandLineParameter(Command = "p", Name = "csproj", Value = "System.ComponentModel.DataAnnotations.csproj", ParameterIndex = 1, Required = true, Description = "project which contains attribute definitions.")]
        public string Source { get; set; }

        [CommandLineParameter(Command = "d", Name = "destination", Value = "System.ComponentModel.DataAnnotations.nump2cs", ParameterIndex = 2, Description = "Specifies the  filename where to save the NUM2CS XMI Model.")]
        public string Destination { get; set; }


    }

}
